package com.itheima.convertedio;

import java.io.*;

public class ConvertedDemo1 {
    public static void main(String[] args) throws IOException {
//        method1();
        InputStreamReader isr = new InputStreamReader(new FileInputStream("a.txt"), "GBK");

        int ch;
        while ((ch = isr.read()) != -1) {
            System.out.println((char) ch);
        }

        isr.close();

        OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("b.txt"), "UTF-8");
        osw.write("今天天气挺好~");
        osw.close();
    }

    private static void method1() throws IOException {
        FileReader fr = new FileReader("a.txt");
        int ch;
        while ((ch = fr.read()) != -1) {
            System.out.println((char) ch);
        }
        fr.close();
    }
}
